//
//  baseVC.swift
//  swift_airu
//
//  Created by A on 2025/9/19.
//

import UIKit
class baseVC: UIViewController,UIGestureRecognizerDelegate {
    var navBarHidden: Bool = false

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.navigationController?.setNavigationBarHidden(navBarHidden, animated: true)

        
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = .red
        // 开启侧滑返回手势
               if let nav = self.navigationController {
                   nav.interactivePopGestureRecognizer?.delegate = self
                   nav.interactivePopGestureRecognizer?.isEnabled = true
               }
    }
    // MARK: - UIGestureRecognizerDelegate
       func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
           // 如果是根控制器，不允许侧滑返回
           return self.navigationController?.viewControllers.count ?? 0 > 1
       }

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}
